/**
 * Created by Administrator on 2017/6/5.
 */
class testClass{

  constructor(x='',y=''){
    this.x  =x;
    this.y  =y;

  }
  toString(){
    console.log(`坐标: x:${this.x},y:${this.y}`);
  }
  static test_one(){
    return 'hello my task';
  }

  get name(){

  }
  set name(x){

  }
}

let test_class=new testClass();

class testChild extends testClass{

  constructor(x='',y=''){
    super(x,y)
  }

  static  sayFather(){
    let test    = super.test_one();
    console.log(test);
  }

}

let myTest    = new testChild(15,12);
myTest.toString();
testChild.sayFather();


let test_one=[name,age]=['小小花',18]; // 解构

console.log(`hello ${name} are you age: ${age}  years old ?? yes i am.....`);// 字符串模板


function hello(...x) {  // 参数不固定
  console.log(x);
}

let test=new hello(1,2,3,3,5);

let human={
  sayWhy(){
    console.log(' I am human AllRI');
  }
};

let testHuman={
   __proto__:human,  //对象字面量原形
  firstName:'hello human',   //对象字面量的原形
  sayHello(){
     console.log(this.firstName);  // 字面量函数 不必用function声明
  }
};
testHuman.sayWhy();
testHuman.sayHello();
let s =new Set();
s.add('hello').add('myName').add('hello');
console.log(s.size)
console.log(s.has('hello'));
console.log(s.values());
s.forEach(value=>{console.log(value)});
let map     = new Map();
map.set('myName','小小刘');
map.set('age',18);
map.delete('myName');
console.log(map.get('myName'));
console.log(map.get('age'));

let index=[1,2,3].findIndex(x => x == 3);
let obj ={name:'小小花',age:18};
// "abcde".contains("cd"); // true
let string="abc".repeat(3);// "abcabcabc"
console.log(string);
let new_arr   =Array.of(1, 2, 3);
console.log(new_arr);
// console.log(string);
console.log(index);
let o=new Set();
[2,3,4,5,5,2,2].map(x=>o.add(x));
console.log(o.values());
// o.forEach((x)=>{console.log(x)});
for(let k of o){
  console.log(k);
}

let testMap ={name:'小小花',age:18};
for(let value in testMap){
  console.log(value);
}

let test_str='contains';
let xx=test_str.startsWith('con');
let yy=test_str.endsWith('ns');
console.log(xx,yy);
